package com.xiaoshuidi.cloud.module.bpm.enums.swo;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ResponsiblePartyEnum {

    TENANTS("租客", 1),
    THIRD_PARTY("第三方", 2),
    FIRM("公司", 3)
    ;

    private String name;
    private Integer value;

    public static String getNameByValue(Integer value) {
        ResponsiblePartyEnum responsiblePartyEnum = Arrays.stream(ResponsiblePartyEnum.values()).filter(p -> p.getValue().equals(value)).findFirst().orElse(null);
        if (ObjectUtil.isEmpty(responsiblePartyEnum)) {
            return "";
        }
        return responsiblePartyEnum.getName();
    }
    }
